<%-- 
    Document   : dodadiTretman
    Created on : 21.5.2011, 17:08:
    Author     : Ruzin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="com.zproekt.entity.Pacient" %>
<%@page import="com.zproekt.entity.Termin"%>
<%@page import="com.zproekt.servis.OrdinacijaCRUD" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link rel="stylesheet" type="text/css" href="style.css" />

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Додавање на термин</title>
        </head>
         <% 
            if (request.getSession().getValue("permisija") == null){
                response.sendRedirect("index.jsp?error=true");
            }
            String permisija = request.getSession().getValue("permisija").toString();
            if (permisija.equals("user") || permisija.isEmpty()) {
              response.sendRedirect("user.jsp?error=true");
            }
           // out.println("<h2>"+permisija+"</h2>");
        %>
            <% Pacient pacient = OrdinacijaCRUD.getPacient(Long.valueOf(request.getParameter("id_pacient")));
               pageContext.setAttribute("pacient", pacient);
               String datum = request.getParameter("datum");
               pageContext.setAttribute("datum", datum);
               String vreme = request.getParameter("vreme");
               pageContext.setAttribute("vreme", vreme);
               String terminId = request.getParameter("id_termin");
               pageContext.setAttribute("terminId", terminId);
               Termin tretman = OrdinacijaCRUD.getTermin(Long.valueOf(request.getParameter("id_termin")));
               pageContext.setAttribute("tretman", tretman);
               
            %>
            <body>
                <div class="head">
               <div class="text">
                    Добродојдовте на страната на стоматолошката ординација
                    
                </div>
                <div class="logo"></div>
             </div>
             <h1>Додавање третман за ${pacient.getIme()} ${pacient.getPrezime()}</h1>
            <h2>Датум на терминот: ${datum} во ${vreme}</h2>
            <form action="izmeniTermin.do">
            Третман:<input type="text" name="tretman" value="Опис на третманот"/>
            <input type="text" name="datum" value="${datum}" style="display: none"/>
            <input type="text" name="vreme" value="${vreme}" style="display: none"/>
            <input type="text" name="pacient" value="${pacient.getId()}"  style="display: none"/>
            <input type="text" name="id" value="${terminId}" style="display: none"/><br/>
            <input type="submit" value="Запиши го третманот!"/>
            </form>
            <br/>
            <form action="admin.jsp">
                <input type="submit" value="Откажи!"/>
            </form>
            <div class="footer">
                        Copyright Ruzin © 2011
           </div>
        </body>
    </html>
</f:view>
